#define  _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<assert.h>
void Sort(int a[][2], int n)
{
	int gap = n;
	while (gap > 1)
	{
		gap = gap / 3 + 1;
		int i = 0;
		for (i; i < gap; i++)
		{
			int j = 0;
			for (j = i; j < n - gap; j += gap)
			{
				int end = j + gap;
				int tmp = a[end][1];
				int tmp2 = a[end][0];
				while (end > 0)
				{
					if (a[end - gap][1] > tmp)
					{
						a[end][1] = a[end - gap][1];
						a[end][0] = a[end - gap][0];
						end -= gap;
					}
					else
						break;
				}
				a[end][1] = tmp;
				a[end][0] = tmp2;
			}
		}
	}
}
void sort(int a[], int n)
{
	int gap = n;
	while (gap > 1)
	{
		gap = gap / 3 + 1;
		int i = 0;
		for (i; i < gap; i++)
		{
			int j = 0;
			for (j = i; j < n - gap; j += gap)
			{
				int end = j + gap;
				int tmp = a[end];
				while (end > 0)
				{
					if (a[end - gap] > tmp)
					{
						a[end] = a[end - gap];
						end -= gap;
					}
					else
						break;
				}
				a[end] = tmp;
			}
		}
	}
}
int main()
{
	int n, m;
	scanf("%d %d", &n, &m);
	int key[1000] = { 0 };
	int start[2000][2] = { 0 };
	int ret[2000][2] = { 0 };
	int size = m;
	int i = 0;
	for (i=1; i <= n; i++)
	{
		key[i] = i;
	}
	int j = 0;
	int max = 0;
	while (m--)
	{
		int a, b, c;
		scanf("%d %d %d", &a, &b, &c);
		start[j][0] = a;
		start[j][1] = b;
		ret[j][0] = a;
		ret[j][1] = b+c;
		if (b + c > max)
			max = b + c;
		j++;
	}
	Sort(start,size);
	Sort(ret,size);
	i = 0;
	j = 0;
	int second = 0;
	for (second; second <= max; second++)
	{
		if (j != size )
		{
			int arr[2000] = { 0 };
			int ct = 0;
			while (ret[j][1] == second)
			{
				arr[ct] = ret[j][0];
				j++;
				ct++;
			}
			sort(arr, ct);
			int x = 1;
			int g = 0;
			for (g; g < ct; g++)
			{
				for (x=1; x <= n; x++)
				{
					if (key[x] == 0)
					{
						key[x] = arr[g];
						break;
					}
				}
			}
		}
		if (i != size )
		{
			while (start[i][1] == second)
			{
				int x = 0;
				for (x = 1; x <= n; x++)
				{
					if (key[x] == start[i][0])
					{
						key[x] = 0;
						break;
					}
				}
				i++;
			}
		}
	}
	for (i = 1; i <= n; i++)
	{
		printf("%d ", key[i]);
	}
}